package com.shijiwei.trip.fragment;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.shijiwei.trip.R;
import com.shijiwei.trip.bean.RecommendBean.Recommend;
import com.shijiwei.trip.utils.UrlConstants;

import org.xutils.common.Callback;
import org.xutils.common.util.LogUtil;
import org.xutils.http.RequestParams;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

/**
 * Created by sjw on 2015/12/9.
 */
@ContentView(R.layout.fragment_recommend)
public class RecommendFragment extends AppBaseFragment {
    @ViewInject(R.id.lv_recommend)
    private PullToRefreshListView listView;

    private Recommend recommend;

    public static RecommendFragment newInstance() {

        Bundle args = new Bundle();
        
        RecommendFragment fragment = new RecommendFragment();
        fragment.setArguments(args);
        return fragment;
    }
    @Override
    public void initView() {

        listView.setMode(PullToRefreshBase.Mode.BOTH);

        x.http().get(new RequestParams(UrlConstants.URL_RECOMMEND_GET), new Callback.CommonCallback<String>() {
            @Override
            public void onSuccess(String result) {
                LogUtil.e("------------"+result);
//                recommend = JSONObject.parseObject(result,Recommend.class);
                LogUtil.e("------------"+recommend);
            }

            @Override
            public void onError(Throwable ex, boolean isOnCallback) {

            }

            @Override
            public void onCancelled(CancelledException cex) {

            }

            @Override
            public void onFinished() {

            }
        });

    }

    @Override
    public void initData() {
    }

}
